package API.Map.HashMap.Practise.Vote;

import java.util.*;

public class Vote {
    public static void main(String[] args) {
        String[] arr = {"A","B","C","D"};
        List<String> list = new ArrayList<String>();
        Map<String, Integer> map = new HashMap<String, Integer>();
        Random rand = new Random();
        for (int i = 0; i < 80; i++) {
            list.add(arr[rand.nextInt(arr.length)]);
        }
        for(String i : list) {
            if(!map.containsKey(i)) {
                map.put(i, 1);
            } else {
                map.put(i, map.get(i) + 1);
            }
        }
        for(Map.Entry<String, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey() + " : " + entry.getValue());
        }
    }
}
